#ifndef BlendAttached_H
#define BlendAttached_H
#include <QObject>
#include <QtQmlIntegration>

class BlendAttached;
class Blend:public QObject{
    Q_OBJECT
    QML_ELEMENT
    QML_ATTACHED(BlendAttached)
    QML_UNCREATABLE("")

    static BlendAttached *qmlAttachedProperties(QObject *object);
};

class BlendAttached:public QObject{
    Q_OBJECT
public:
    BlendAttached(QObject* parent = nullptr);

    float alpha() const;
    void setAlpha(float newAlpha);

    QStringList getNodeList() const;
    void setNodeList(const QStringList &newNodeList);

    QObject *getFilterNode() const;
    void setFilterNode(QObject *newFilterNode);

signals:
    void alphaChanged();

    void nodeListChanged();

    void filterNodeChanged();

private:
    void updateFilter();

private:
    float m_alpha = 0;
    QStringList nodeList;
    QObject* filterNode;
    Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged FINAL)
    Q_PROPERTY(QStringList nodeList READ getNodeList WRITE setNodeList NOTIFY nodeListChanged FINAL)
    Q_PROPERTY(QObject *filterNode READ getFilterNode WRITE setFilterNode NOTIFY filterNodeChanged FINAL)
};

#endif
